package net.wofly.sale.exchange.validator;


import net.wofly.sale.exchange.domain.CardExchange;
import net.wofly.sale.exchange.domain.ExchangeConsume;
import net.wofly.sale.signin.domain.SignIn;
import org.springframework.util.StringUtils;

import java.io.File;

/**
 * @author siqingwei
 */
public class ExchangeValidator {
    
    /**
     * 换行符
     */
    private static String lineSeparator = System.getProperty("line.separator");

    public static String validateGetSignInParams(String employeeID) {
        StringBuffer stringBuffer = new StringBuffer();
        if (StringUtils.isEmpty(employeeID)) {
            stringBuffer.append("员工ID不能为空").append(lineSeparator);
        }
        return stringBuffer.toString();
    }

    public static String validateAddCardExchangeParams(CardExchange cardExchange) {
        StringBuffer stringBuffer = new StringBuffer();
        if (cardExchange == null) {
            stringBuffer.append("卡兑换实体不能为空").append(lineSeparator);
        } else {
            if (StringUtils.isEmpty(cardExchange.getSalesmanUserID())) {
                stringBuffer.append("业务员ID不能为空").append(lineSeparator);
            }
            if (StringUtils.isEmpty(cardExchange.getCustomerUserID())) {
                stringBuffer.append("客户id不能为空").append(lineSeparator);
            }
//            if (StringUtils.isEmpty(cardExchange.getCardType())) {
//                stringBuffer.append("卡类类型不能为空").append(lineSeparator);
//            }
//            if (StringUtils.isEmpty(cardExchange.getExchangeNum())) {
//                stringBuffer.append("兑换数量不能为空").append(lineSeparator);
//            }
        }
        return stringBuffer.toString();
    }

    public static String validateAddExchangeConsumeParams(ExchangeConsume exchangeConsume) {
        StringBuffer stringBuffer = new StringBuffer();
        if (exchangeConsume == null) {
            stringBuffer.append("兑换消费实体不能为空").append(lineSeparator);
        } else {
            if (StringUtils.isEmpty(exchangeConsume.getUserID())) {
                stringBuffer.append("业务员ID不能为空").append(lineSeparator);
            }
            if (StringUtils.isEmpty(exchangeConsume.getOrderID())) {
                stringBuffer.append("订单ID不能为空").append(lineSeparator);
            }
            if (StringUtils.isEmpty(exchangeConsume.getConsumeNum())) {
                stringBuffer.append("消费数量不能为空").append(lineSeparator);
            }
        }
        return stringBuffer.toString();
    }

    public static String validateGetAllExchangeStockParams(String condition) {
        StringBuffer stringBuffer = new StringBuffer();
        return stringBuffer.toString();
    }

    public static String validateGetMyCardExchangeParams(String userID) {
        StringBuffer stringBuffer = new StringBuffer();
        if (StringUtils.isEmpty(userID)) {
            stringBuffer.append("用户ID不能为空").append(lineSeparator);
        }
        return stringBuffer.toString();
    }

    public static String validateGetMyExchangeConsumeParams(String userID) {
        StringBuffer stringBuffer = new StringBuffer();
        if (StringUtils.isEmpty(userID)) {
            stringBuffer.append("用户ID不能为空").append(lineSeparator);
        }
        return stringBuffer.toString();
    }

    public static String validateGetMyExchangeStockParams(String userID) {
        StringBuffer stringBuffer = new StringBuffer();
        if (StringUtils.isEmpty(userID)) {
            stringBuffer.append("用户ID不能为空").append(lineSeparator);
        }
        return stringBuffer.toString();
    }
}
